package xyz.xtt.pay.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author dale
 * @since 2025-02-25
 */
@Data
@Builder
@Accessors(chain = true)
@TableName("tbl_business_order")
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "TblBusinessOrder对象", description = "订单表")
@AllArgsConstructor
@NoArgsConstructor
public class TblBusinessOrder implements Serializable {

	private static final long serialVersionUID = 1L;

	@TableId("order_id")
	@ApiModelProperty("订单ID（唯一标识）")
	private Long orderId;
	
	@ApiModelProperty(value = "关联业务id")
	private String businessRefId;

	@ApiModelProperty("用户ID（下单用户）")
	private Long appUserId;

	@ApiModelProperty("卖方用户ID（商家）")
	private Long sellerId;

	@ApiModelProperty("商品类型（1-数藏实物卡牌）")
	private Integer goodsType;

	@ApiModelProperty("商品ID")
	private String goodsId;

	@ApiModelProperty("商品名称（冗余存储，方便查询）")
	private String goodsName;

	@ApiModelProperty("商品图片URL")
	private String goodsImage;

	@ApiModelProperty("购买数量")
	private Integer purchaseNum;

	@ApiModelProperty("商品原单价（单价）")
	private BigDecimal originPrice;

	@ApiModelProperty("实际成交单价（含折扣、活动）")
	private BigDecimal realPrice;

	@ApiModelProperty("运费")
	private BigDecimal transportPrice;

	@ApiModelProperty("订单总金额（real_price * purchase_num）")
	private BigDecimal totalPrice;

	@ApiModelProperty("优惠金额（如使用优惠券）")
	private BigDecimal discountAmount;

	@ApiModelProperty("最终支付金额（total_price - discount_amount）")
	private BigDecimal payAmount;

	@ApiModelProperty("支付时间")
	private LocalDateTime paySuccessTime;

	@ApiModelProperty("订单状态（0-待支付 1-支付成功 2-支付失败 3-支付取消 4-已退款 5-支付中）")
	private Integer orderStatus;

	@ApiModelProperty("下单时间")
	private LocalDateTime orderTime;

	@ApiModelProperty("取消订单时间")
	private LocalDateTime cancelTime;

	@ApiModelProperty("取消订单原因")
	private String cancelReason;

	@ApiModelProperty("收货地址ID（外键关联用户地址表）")
	private Long receiveAddressId;

	@ApiModelProperty("物流公司名称")
	private String transportCompany;

	@ApiModelProperty("物流单号")
	private String transportNo;

	@ApiModelProperty("创建时间")
	private LocalDateTime createTime;

	@ApiModelProperty("更新时间")
	private LocalDateTime updateTime;

	@ApiModelProperty("版本号（从0开始，每次更新加1）")
	private Long ver;
}
